package pcjavanet.mobilesell.service;

import java.util.List;

import pcjavanet.mobilesell.model.Suppliers; 
import pcjavanet.mobilesell.model.PageBean;
import pcjavanet.mobilesell.model.SuppliersExample;
import pcjavanet.mobilesell.model.QryCondition;
import pcjavanet.mobilesell.model.QryTerm;
import pcjavanet.mobilesell.persistence.SuppliersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class SuppliersService {


  @Autowired
  private  SuppliersMapper suppliersMapper;


  public int  insert( Suppliers suppliers ) throws Exception{
	return suppliersMapper.insert (suppliers);
  }


  public Suppliers  selectByPrimaryKey( Suppliers  bean ) {
 	int dbid = bean.getDbid();
	Suppliers suppliers = suppliersMapper.selectByPrimaryKey( dbid );
	return suppliers ;
  }


  public int  updateByPrimaryKeySelective( Suppliers suppliers ) throws Exception{
	return suppliersMapper.updateByPrimaryKeySelective( suppliers );
  }


  public int  deleteByPrimaryKey( Suppliers  bean ) throws Exception{
 	int dbid = bean.getDbid();
	return suppliersMapper.deleteByPrimaryKey( dbid );
  }


  public List<Suppliers>  selectByExample( Suppliers suppliers ) throws Exception{
    SuppliersExample example = new SuppliersExample();
	return suppliersMapper.selectByExample( example );
  }

  public List<Suppliers>  getOnePageBeans( QryCondition condition , PageBean pageBean ) throws Exception{
    SuppliersExample example = new SuppliersExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	List<Suppliers> ls=suppliersMapper.getOnePageBeans( example , pageBean );
//begin
	if ( ls.size() > 0 ) {
	}
//end
	return ls;
  }

  public int getTotalRecords( QryCondition condition , PageBean pageBean ) throws Exception{
    SuppliersExample example = new SuppliersExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	return suppliersMapper.getTotalRecords( example , pageBean );
  }

  public int countByExample( Suppliers suppliers , PageBean pageBean ){
    SuppliersExample example = new SuppliersExample();
	return suppliersMapper.countByExample( example );
  }
  public List<Suppliers> selectByExamplePage( Suppliers suppliers , PageBean pageBean ){
  SuppliersExample example = new SuppliersExample();
	return suppliersMapper.selectByExamplePage( example , pageBean );
  }

}
